from uimethod import *  # 导入 uimethod.py 中的函数
from uidesign import Ui_Form  # 导入 UI 设计

class SchedulerAppWithUI(SchedulerApp, Ui_Form):
    def __init__(self):
        QMainWindow.__init__(self)
        Ui_Form.__init__(self)
        self.setupUi(self)  # 调用 Ui_Form 中的 setupUi 设置 UI
        self.setup_connections()
        self.scheduler = Scheduler()  # 确保创建 scheduler 实例
    def setup_connections(self):
        """连接 UI 控件与功能"""
        # 连接按钮的点击事件
        self.init_button.clicked.connect(self.on_initialize)
        self.schedule_button.clicked.connect(self.on_schedule)
        self.show_results_button.clicked.connect(self.on_show_results)

        # 连接表格的单元格点击事件
        self.reservation_table.cellClicked.connect(self.on_cell_clicked)

if __name__ == "__main__":
    app = QApplication(sys.argv)

    # 创建并显示窗口
    window = SchedulerAppWithUI()
    window.show()

    sys.exit(app.exec())  # 运行事件循环